const express = require("express")
const app = express()
const collect = require('../service/user/collect')



app.get("/collect",async(req,res)=>{
    console.log(req.query)
    let result = await collect.getUsercollectId(req.query.userId)
    console.log(result);
    res.send(result)
})


app.get("/collectList",async(req,res)=>{
    console.log(JSON.parse(req.query.houseId))

    let result = await collect.getUsercollect(JSON.parse(req.query.houseId))
    // console.log(result);
    res.send(result)
})


app.get("/usercollectdelete",async(req,res)=>{

    let result = await collect.DeleteUsercollect(req.query.userId,req.query.houseId)
    // console.log(result);
    res.send(result)
})

app.get("/usercollect",async(req,res)=>{

    let result = await collect.addUsercollect(req.query.userId,req.query.houseId)
    // console.log(result);
    res.send(result)
})







// goods
app.get("/whetherUserCollectGoods",async(req,res)=>{
    console.log(req.query);
    let result = await collect.getWhetherUserCollectGoods(req.query.userId,req.query.goodsId)
    console.log(result);
    res.send(result)
})

app.get("/userCollectGoods",async(req,res)=>{
    console.log(req.query);
    let result = await collect.userCollectGoods(req.query.userId,req.query.goodsId)
    // console.log(result);
    res.send(result)
})



app.get("/userdeleteCollectGoods",async(req,res)=>{

    let result = await collect.userDeletecollect(req.query.userId,req.query.goodsId)
    // console.log(result);
    res.send(result)
})
module.exports = app;